the pi function